package com.cts.common;

import com.cts.model.vo.Result;
import com.cts.util.DictUtils;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @projectName: CBlog
 * @package: com.cts.common
 * @className: DictController
 * @author: chentongsheng
 * @description: TODO
 * @date: 2023/5/2 16:20
 * @version: 1.0
 */
@RestController
@RequestMapping("/dict")
public class DictController {

    @Autowired
    private DictUtils dictUtils;


    @ApiOperation("获取分类列表")
    @RequestMapping("getCategoryDict")
    public Result getCategoryDict() {
        Map<Long, String> cateGoryDict = dictUtils.getCateGoryDict();
        return Result.ok("请求成功", cateGoryDict);
    }

    @RequestMapping("/getTagDict")
    public Result getTagDict() {
        Map<Long, String> tagDict = dictUtils.getTagDict();
        return Result.ok("请求成功", tagDict);
    }
}
